package com.athuahua.r2dbc.repositories;

import com.athuahua.r2dbc.entity.TAuthor;
import org.springframework.data.r2dbc.repository.Query;
import org.springframework.data.r2dbc.repository.R2dbcRepository;
import org.springframework.data.repository.reactive.ReactiveCrudRepository;
import org.springframework.stereotype.Repository;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

/**
 * @Author: huahua
 * @Date: 2024/12/2 0002
 * @Time: 18:08
 * @Description:
 */
//类似于mybatis-plus
@Repository
public interface AuthorRepositories
        extends R2dbcRepository<TAuthor,Long> { //<类型,主键ID>

    //默认继承一堆CRUD

    //单表复杂查询
    //起名工程师 照着查询起名 where id and name like ?
    Flux<TAuthor> findAllByIdAndNameLike(Long id, String name);
    Flux<TAuthor> findAllById(Long id);

    Flux<TAuthor> findAllByNameLike(String name);

    //多表复杂查询

    @Query("select * from t_author") //自定义query注解，指定sql语句
    Flux<TAuthor> myFind();

    //1-1
    //1-n
















}
